<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-home"></i>公告通知</h5>
                    <div class="ibox-tools"><a href="?" class="btn btn-xs btn-danger"><i
                            class="fa fa-refresh"></i>刷新</a></div>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <form id="pagerForm" method="post" class="form-inline">
                            <div class="col-sm-3 m-b-xs">
                                <a class="btn btn-info single_operation" data-act="add" href="javascript:void(0)"><i
                                        class="fa fa-plus"></i>添加</a>
                                <div class="btn-group">
                                    <button data-toggle="dropdown" class="btn btn-default dropdown-toggle">批量操作 <span
                                            class="caret"></span></button>
                                    <ul class="dropdown-menu">
                                        <li><a href="javascript:void(0)" class="batch_operation"
                                               data-act="read">批量已读</a></li>
                                        <li class="divider"></li>
                                        <li><a href="javascript:void(0)" class="batch_operation" data-act="del">批量删除</a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="col-sm-9 m-b-xs text-right">
                                <div class="input-group pd-b-5">
                                    <input type="text" name="keywords" placeholder="输入主题关键字搜索" class="form-control">
                                </div>
                                <div class="input-group">
                  <span class="input-group-btn">
                  <button type="button" class="btn btn-primary ajaxSearchForm"><i class="fa fa-search"></i> 搜索</button>
                  </span></div>
                            </div>
                        </form>
                    </div>
                    <table class="table table-hover sorttable 07fly-table" width="100%">
                        <thead>
                        <tr>
                            <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                            <th width="150">标题</th>
                            <th width="200">发布内容</th>
                            <th width="60">发布人</th>
                            <th width="80">发布时间</th>
                            <th width="80">状态</th>
                            <th width="80">接收人</th>
                            <th width="80">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                        <tfoot class="ibox-content">
                        <tr>
                            <td colspan="11" align="center"></td>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script id="tableListTpl" type="text/html">
    <% for(var i=0;i
    <list.length;i++) { %>
    <tr>
        <td><input name="notice_id" class="checkboxCtrlId" value="<%=list[i]['id']%>" type="checkbox"></td>
        <td><%=list[i]['title']%></td>
        <td><%=list[i]['content']%></td>
        <td><%=list[i]['create_user']['name']%></td>
        <td><%=list[i]['create_time']%></td>
        <td><%:=list[i]['status_arr']['status_name_html']%></td>
		<td><%=list[i]['owner_user']['name']%></td>
        <td>
            <p><a href="javascript:void(0)" class="single_operation" data-id="<%=list[i]['id']%>" data-act="view">查看</a>
            </p>
            <p><a href="javascript:void(0)" class="single_operation" data-id="<%=list[i]['id']%>" data-act="del">删除</a>
            </p>
        </td>
    </tr>
    <% } %>
</script>
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script>
<script type="text/javascript">
    var ajaxUrl = '#{$smarty.const.ACT}#/sysmanage/Notice/notice_show_json/';
    $(document).ready(function () {
        turnPage(1);//页面加载时初始化分页

        $("body").on("click", ".batch_operation", function () {
            batch_act = $(this).attr("data-act")
            var chk_value = [];
            $("tbody input[class='checkboxCtrlId']:checked").each(function () {
                chk_value.push($(this).val());
            });
            notice_id_txt = chk_value.join(",");
            if (batch_act == "del") {
                act_url = "#{$smarty.const.ACT}#/sysmanage/Notice/notice_del/";
                $.ajax({
                    type: "POST",
                    url: act_url,
                    data: {"notice_id": notice_id_txt},
                    dataType: "json",
                    success: function (data) {
                        if (data.statusCode == '200') {
                            layer.msg('操作成功', {icon: 1});
                            turnPage(1);
                        }
                    },
                    complete: function () {//完成响应
                    }
                });
            } else if (batch_act == "read") {
                act_url = "#{$smarty.const.ACT}#/sysmanage/Notice/notice_read/";
                $.ajax({
                    type: "POST",
                    url: act_url,
                    data: {"notice_id": notice_id_txt},
                    dataType: "json",
                    success: function (data) {
                        if (data.statusCode == '200') {
                            layer.msg('操作成功', {icon: 1});
                            turnPage(1);
                        }
                    },
                    complete: function () {//完成响应
                    }
                });
            }
        });

        $("body").on("click", ".single_operation", function () {
            notice_id = $(this).attr("data-id");
            single_act = $(this).attr("data-act")
            if (single_act == "add") {
                layer.open({
                    type: 2,
                    title: '添加通知',
                    shadeClose: true,
                    fixed: false, //不固定
                    area: ['90%', '90%'],
                    content: '#{$smarty.const.ACT}#/sysmanage/Notice/notice_add/',
                    end: function () {
                        turnPage(1);
                    }
                });
                return false;
            } else if (single_act == "view") {
                layer.open({
                    type: 2,
                    title: '查看通知',
                    shadeClose: true,
                    fixed: false, //不固定
                    area: ['90%', '90%'],
                    content: '#{$smarty.const.ACT}#/sysmanage/Notice/notice_view/notice_id/' + notice_id + '/',
                    end: function () {
                        turnPage(1);
                    }
                });
                return false;
            } else if (single_act == "del") {
                act_url = "#{$smarty.const.ACT}#/sysmanage/Notice/notice_del/";
                $.ajax({
                    type: "POST",
                    url: act_url,
                    data: {"notice_id": notice_id},
                    dataType: "json",
                    success: function (data) {
                        if (data.statusCode == '200') {
                            layer.msg('操作成功', {icon: 1});
                            turnPage(1);
                        }
                    }
                });
            }

        });


    });
</script>
</body>

<!-- Mirrored from www.upfine.cn/theme/hplus/table_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:01 GMT -->
</html>
